package com.ybkj.o2o.mc.controller.web;

import com.ybkj.o2o.mc.common.DataGrid;
import com.ybkj.o2o.mc.common.transport.PassengerConcatsResult;
import com.ybkj.o2o.mc.manager.PassengerConcatsManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by shine on 15/8/19.
 */
@RestController
@RequestMapping("passengerConcats")
public class PassengerConcatsController {

  @Autowired
  private PassengerConcatsManager passengerConcatsManager;

  @RequestMapping(value = {"datagrid"}, method = RequestMethod.GET)
  @ResponseBody
  public DataGrid<PassengerConcatsResult> list(@RequestParam("page") int page,
                                               @RequestParam("rows") int rows) {

    return passengerConcatsManager.findByPassengerForPage(null, page, rows);
  }


  @RequestMapping(value = "{id}", method = RequestMethod.GET)
  @ResponseBody
  public DataGrid<PassengerConcatsResult> findPassengerConcats(@PathVariable("id") Long passengerId,
                                                               @RequestParam("page") int page,
                                                               @RequestParam("rows") int rows) {

    return passengerConcatsManager.findByPassengerForPage(passengerId, page, rows);
  }


}
